package com.hqyj.emb.system.service.Impl;

import com.hqyj.emb.system.dao.Impl.User2DaoImpl;
import com.hqyj.emb.system.dao.Impl.UserDaoImpl;
import com.hqyj.emb.system.dao.User2Dao;
import com.hqyj.emb.system.dao.UserDao;
import com.hqyj.emb.system.model.User;
import com.hqyj.emb.system.model.User2;
import com.hqyj.emb.system.service.UserService;
import frame.model.PageBean;

import java.util.List;

public class UserServiceImpl implements UserService {
    UserDao userDao=new UserDaoImpl();


    @Override
    public User queryAllUser(User user) {

        return userDao.queryAllUser(user);
    }

    @Override
    public List<User> queryUserByDb() {
        return userDao.queryUserByDb();
    }

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public int deleteUserByUser(int userIdST) {
        return userDao.deleteUserByUser(userIdST);
    }

    @Override
    public User queryUserByUserId(int userId) {
        return userDao.queryUserByUserId(userId);
    }

    @Override
    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public PageBean<User> queryAllPage(int pc, int ps) {
        PageBean<User> pb = new PageBean<User>();
        pb.setPc(pc);
        pb.setPs(ps);

        // 查询总记录数:总记录数（total record）
        int tr = userDao.queryUser2TotalRecord();
        pb.setTr(tr);

        // 查询当前页的记录
        List<User> beanList = userDao.queryCurrentPageDataList((pc - 1) * ps, ps);
        pb.setBeanList(beanList);
        return pb;
    }


}
